package test;

import lombok.extern.log4j.Log4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.StringRedisTemplate;

@Log4j
@SpringBootApplication
public class ApplicationStart {
    public static void main(String[] args) {
        try {
            SpringApplication.run(ApplicationStart.class,args);
        }catch (Exception e){
            log.info("启动服务异常，异常为：{}",e);
        }

    }

    //使用默认的工厂初始化redis操作模板
    @Bean
    StringRedisTemplate template(RedisConnectionFactory connectionFactory) {
        return new StringRedisTemplate(connectionFactory);
    }
}
